package com.vladimirkolarevic.eventplanner.beans;

import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;

import javax.annotation.Generated;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;

import com.vladimirkolarevic.eventplanner.Comment;
import com.vladimirkolarevic.eventplanner.DateAndTime;
import com.vladimirkolarevic.eventplanner.Event;
import com.vladimirkolarevic.eventplanner.Location;
import com.vladimirkolarevic.eventplanner.Performer;
@Entity
public class EventBean implements Event,Serializable {
	
	@Basic(optional=false)
	private String name;
	
	@Id
	@GeneratedValue
	private Long id;
	
	@OneToOne(targetEntity=DateAndTimeBean.class,cascade=CascadeType.ALL)
	@PrimaryKeyJoinColumn
	private DateAndTime dateAndTime;
	
	
	@OneToOne(targetEntity=LocationBean.class,cascade=CascadeType.ALL)
	@PrimaryKeyJoinColumn
	private Location location;
	
	@ManyToMany(targetEntity=PerformerBean.class,cascade=CascadeType.ALL)
	private List<Performer> performers=new LinkedList<Performer>();
	
	@ManyToMany(targetEntity=CommentBean.class,cascade=CascadeType.ALL)
	private List<Comment> comments = new LinkedList<Comment>();
	
	public EventBean() {
		// TODO Auto-generated constructor stub
	}
	
	public Long getId() {
		// TODO Auto-generated method stub
		return id;
	}

	public String getName() {
		// TODO Auto-generated method stub
		return name;
	}

	public void setName(String name) {
		this.name=name;
		
	}
	
	public DateAndTime getDateAndTime() {
		return dateAndTime;
	}
	
	public void setDateAndTime(DateAndTime dateAndTime) {
		this.dateAndTime = dateAndTime;
	}

	public Location getLocation() {
		return location;
	}

	public void setLocation(Location location) {
		this.location = location;
	}

	
	public List<Performer> getPerformers() {
		// TODO Auto-generated method stub
		return performers;
	}

	
	public void setPerformers(List<Performer> performers) {
		// TODO Auto-generated method stub
		this.performers=performers;
	}


	public void addPerformer(Performer performer) {
		performers.add(performer);
		
	}


	public void addComment(Comment comment) {
		comments.add(comment);
		
	}


	public List<Comment> getComments() {
		// TODO Auto-generated method stub
		return comments;
	}

	
	public void setComments(List<Comment> comments) {
		// TODO Auto-generated method stub
		this.comments=comments;
	}

	

	
	
}
